package cfengMiddleware.server.service;

import cfengMiddleware.server.dto.UserAccountDto;

/**
 * @author Cfeng
 * @date 2022/9/20
 */

public interface UseAccountService {

    //无锁方式进行提现
    void takeMoney(UserAccountDto userAccountDto) throws Exception;

    //乐观锁方式进行提现
    void takeMoneyWithVersion(UserAccountDto userAccountDto) throws Exception;

    //悲观锁方式进行提现
    void takeMoneyWithLock(UserAccountDto userAccountDto) throws Exception;

    //redis方式分布式锁
    void takeMoneyWithRedisLock(UserAccountDto userAccountDto) throws Exception;

    //Zookeeper实现分布式锁
    void takeMoneyWithZookeeper(UserAccountDto userAccountDto) throws Exception;

    //redisson实现一次性锁（不可重入，失败永久失败）
    void takeMoneyWithRedisson(UserAccountDto userAccountDto) throws Exception;

    //redisson实现可重入锁reentrantLock
    void takeMoneyWithRedissonReentrantLock(UserAccountDto userAccountDto) throws Exception;
}
